const path = require("path");
const webpack = require('webpack');
const WebpackDevServer = require('webpack-dev-server');

const rootPath = path.resolve(__dirname,"app"),
       src = path.join(rootPath,"component");

module.exports = {
    devtool: 'source-map',
    entry: [
        path.resolve(__dirname, 'app', 'App.js'),
    ],
    output: {
        path: path.resolve(__dirname, "build"),
        filename: "js/bundle.js",
        // publicPath: '/',   //指定资源文件引用的目录
        /*
         用处：例如在express中，指定了public/dist是网站的根目录，网站的源文件存放在public中，
         那么就需要设置path:”./dist”指定打包输出到该目录，而publicPath就需要设置为”/”,表示当前路径。
         */
        // chunkFilename: '[name].[chunkhash:10].chunk.js', //单独打包chunk块的名称

        // library: 'webpackNumbers',  //全局变量
        // libraryTarget:["var"],  // 添加环境支持

        // hotUpdateChunkFilename: "[id].[hash].hot-update.js"
    },
    resolve:{
        extensions: ["",'.js','.jsx'],
        alias:{
            ANT_DE:path.join(src,"general/ant_plugin.js"),
            EVE_MAN:path.join(src,"util/EventManager.js"),
            fly:path.join(src,"common/fly/index.js")
        }
    },
    module: {
        loaders: [{
            test: /\.js|jsx$/,
            exclude: /node_modules/,
            loader: "babel-loader"
        }, {
            test: /\.css$/,
            loader: "style!css"

        }, {
            test: /\.scss$/,
            loader: 'style!css!postcss'
        }, {
            test: /\.(png|jpg)$/,
            exclude: /node_modules/,
            loader: 'url-loader'
        }]
    },
};
